package jrpc

import (
	"context"
	"encoding/json"

	"github.com/osamingo/jsonrpc/v2"
	"github.com/zeromicro/go-zero/core/logc"
)

func RegisterMethod() {
	Register(&{{.upperStartCamelObject}}UpdateFunc{})
}

type {{.upperStartCamelObject}}UpdateParams struct {
	*{{.upperStartCamelObject}}
}

type {{.upperStartCamelObject}}UpdateResult struct {
}

type {{.upperStartCamelObject}}UpdateFunc struct {
	{{.upperStartCamelObject}}UpdateParams
	{{.upperStartCamelObject}}UpdateResult
}

func (t *{{.upperStartCamelObject}}UpdateFunc) Name() string {
	return fmt.Sprintf("%s.%s", {{.table}}, "Update")
}

func (t *{{.upperStartCamelObject}}UpdateFunc) ServeJSONRPC(c context.Context, params *json.RawMessage) (result any, err *jsonrpc.Error) {
	logc.Infof(c, "%s( %v )", t.Name(), *params)
	return nil, nil
}

func (t *{{.upperStartCamelObject}}UpdateFunc) Params() any {
	return t.{{.upperStartCamelObject}}UpdateParams
}

func (t *{{.upperStartCamelObject}}UpdateFunc) Result() any {
	return t.{{.upperStartCamelObject}}UpdateResult
}
